package com.bawei.databing_test;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;

import android.os.Bundle;

import com.bawei.databing_test.databinding.ActivityMainBinding;

/**
 * DataBinding:数据和view绑定
 *
 * ActivityMainBinding / ItemBinding:命名xml文件名称
 * 1。列表数据
 * 2。图片适配器
 * 3。双向绑定：搜索框
 *
 *
 *
 */
public class MainActivity extends AppCompatActivity {
    private ActivityMainBinding activityMainBinding;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_main);
        activityMainBinding = DataBindingUtil.setContentView(this, R.layout.activity_main);
        User user = new User("占三", 18, true, "https://img-home.csdnimg.cn/images/20201124032511.png");
        activityMainBinding.setUser(user);
        activityMainBinding.setClickHandlers(new ClickHandlers());
    }

}